from flask import Flask
from flask import request
from flask import redirect,url_for,render_template

app = Flask(__name__)

@app.route("/handle/<name>")
def handle(name):
    content = "欢迎您,<b>%s</b>!"%name
    return content

@app.route("/login",methods=["GET","POST"])
def login():
    method_name = request.method
    # POST方法
    if method_name == "GET":
        # 普通参数
        user = request.args.get("username")
        return redirect(url_for("handle", name=user))
    elif method_name == "POST":
        # 表单值
        user = request.form.get("username")
        return redirect(url_for("handle",name=user))

if __name__ == '__main__':
    app.run(debug=True)